package eu.dicodeproject.analysis.lucene;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.util.Version;

import java.io.Reader;

/**
 * This class wraps the Lucene StandardAnalyzer - ties it to Lucene version 3.0.2 and provides a constructor w/o
 * any arguments for instantiation in the Mahout collocation analysis.
 */
public class StandardAnalyzerWrapper extends Analyzer {
  /** Delegate to StandardAnalyzer. */
  private final Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);

  @Override
  public TokenStream tokenStream(String fieldName, Reader reader) {
    return this.analyzer.tokenStream(fieldName, reader);
  }
}
